Skip to content

Add python-level patches to supporting multiple platforms#49

Merged
lxd-cumt merged 14 commits into
flagos-ai:mainfrom
lxd-cumt:mthreads_fl_test
Mar 23, 2026
Merged

Add python-level patches to supporting multiple platforms#49
lxd-cumt merged 14 commits into
flagos-ai:mainfrom
lxd-cumt:mthreads_fl_test

Conversation

@lxd-cumt

@lxd-cumt lxd-cumt commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

TE-FL Python-level now supports multiple platforms, including the following two changes:

  1. support for vendor-specific patches: vendors can now add their own patches, e.g., patching torch.cuda to torch.musa. For patch implementation, please refer to transformer_engine/plugin/core/backends/vendor/musa/musa_patches.py; for patch integration, please refer to transformer_engine/__init__.py.

  2. abstraction of CUDA device references: files under transformer_engine/ now abstract CUDA device-related code into te_device_type. For example, torch.device("cuda") is now replaced with torch.device(te_device_type).

  3. Fix

  • FlagOS Backend: get_num_cublas_stream and get_cudnn_version
  • Reference Backend: get_num_cublas_stream and scaled_mask_softmax_forward

@zhaoyinglia zhaoyinglia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread transformer_engine/__init__.py Outdated

# Apply MUSA (VENDOR) Patches, such as torch.cuda.device -> torch.musa.device
try:
from .plugin.core.backends.vendor.musa.musa_patches import apply_patch as _musa_apply_patch

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to rename musa_patches to patches?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@heavyrain-lzy heavyrain-lzy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lxd-cumt lxd-cumt merged commit 4f54860 into flagos-ai:main Mar 23, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants